package com.longrise.android.byjk.plugins.hra.hratabsecond;

import com.longrise.LEAP.Base.Objects.EntityBean;
import com.longrise.android.byjk.common.UrlConstants;
import com.longrise.android.loaddata.newloaddata.LoadDataManagerFather;
import com.longrise.common.datasource.remote.LoadDataManager;

/**
 * Created by Administrator on 2018/1/22.
 * 我的预约详情presenter
 */

public class MineOrderDetailPresenter extends MineOrderDetailContract.Presenter{


    @Override
    protected void init() {

    }

    @Override
    public void getOrderDetailData(String orderid) {
        EntityBean bean = new EntityBean();
        bean.set("orderid ", orderid);
        EntityBean bean1 = new EntityBean();
        bean1.set("bean", bean);
        LoadDataManager.getInstance().callService2(null, UrlConstants.BaseUrl, "hra_searchHRAByOrderId", bean1, new LoadDataManager.OnRequestCallListener2() {

            @Override
            public void onSuccess(String key, String service, Object result) {
                try {
                    EntityBean bean = (EntityBean) result;
                    int resultstate = bean.getInt("resultstate");
                    if (resultstate == 1){
                        mView.refreshData(bean);
                    }else {
                        mView.showToast(bean.getString("resultdesc"));
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }


            @Override
            public void onFinished(String key, String service) {
                mView.showContentPage();
                mView.setRefreshing(false);
            }

            @Override
            public void onError(String key, String service, LoadDataManagerFather.ResultType resultType) {

            }

        });
    }
}
